package risk.control.project.config.constant;

import org.apache.commons.codec.binary.Hex;

import java.util.HashMap;

/**
 * 统一管理所有的秘钥
 */
public interface SecretKey {

    HashMap<String, String> Map = new HashMap<>() {
        {
            //基础加解密-秘钥
            put("base_secret_key", formatSecretKey("kokL8G4RmNfV69cdcJ9dfnrlFGsLy6mH"));

            //session加解密-秘钥
            put("session_secret_key", formatSecretKey("QHilvk7D3Phq766hQHilvk7D3Phq766h"));

            //token加解密-秘钥
            put("token_secret_key", formatSecretKey("1A0ErhOMJoZ0VHhbO6kLIDNyKC1aWG5K"));
        }
    };

    //格式化
    private static String formatSecretKey(String secretKey) {
        return Hex.encodeHexString(secretKey.getBytes());
    }
}
